package model.event;

/**
 * This class represents a UserEvent. A UserEvent occurs if a user logs in, logs
 * out or disconnects.
 * 
 * @version 1.0 vom 12.11.2012
 * @author Distributed Group 111 1026312, 1026309
 */

public class UserEvent extends Event {

	private static final long serialVersionUID = 2232194822974255650L;
	private String userName;

	public UserEvent(EventType type, String userName) {
		super(type);
		this.userName = userName;
	}

	public String getUserName() {
		return this.userName;
	}

	public String toString() {
		super.toString();
		if (EventType.USER_LOGIN.equals(this.type))
			return super.toString() + "user " + this.userName + " logged in";
		else if (EventType.USER_LOGOUT.equals(this.type))
			return super.toString() + "user " + this.userName + " logged out";
		else if (EventType.USER_DISCONNECTED.equals(this.type))
			return super.toString() + "user " + this.userName + " disconnected";
		else
			return "";
	}
}